package com.example.log.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024-11-28
 * Time: 10:55
 */
@RestController
@RequestMapping("/request")
public class LoggerController {
    private static Logger logger =
            LoggerFactory.getLogger(LoggerController.class);

    @RequestMapping("/printLog")
    public String printLog(){
        logger.trace("======trace======");
        logger.debug("=======debug=======");
        logger.info("==========info======");
        logger.warn("========warn========");
        logger.error("=======error========");
        return "success";
    }



    @RequestMapping("/logger2")
    public String logger2(){
        logger.info("使用Logger对象打印日志");
        return "打印日志";
    }



    @RequestMapping("/logger1")
    public String logger(){
        System.out.println("打印日志");
        return "打印日志";
    }
}


